package feign

import (
	"gitee.com/kristas/booting-go/framework/core/statement/types"
)

type BaseClient struct {
	types.Component
	name string
	url  string
	path string
}

func (b *BaseClient) Name() string {
	return b.name
}

func (b *BaseClient) Url() string {
	return b.url
}

func (b *BaseClient) Path() string {
	return b.path
}

func (b *BaseClient) ResolveName(name string) string {
	b.name = name
	return b.name
}

func (b *BaseClient) ResolveUrl(url string) string {
	b.url = url
	return b.url
}

func (b *BaseClient) ResolvePath(path string) string {
	b.path = path
	return b.path
}

func (b *BaseClient) Target() string {
	var url string
	if b.Name() != "" {
		url = b.Name()
	} else {
		url = b.Url()
	}
	return url + b.Path()
}
